package com.product.android.commonInterface.weibo;

import java.io.IOException;
import java.io.Serializable;

import com.common.android.utils.parser.BaseType;
import com.product.android.utils.FileHelper;

import android.text.TextUtils;


public class FlowerMessageInfo implements BaseType,Serializable{

	//serialVersionUID:TODO（用一句话描述这个变量表示什么）
	public static final long serialVersionUID = 2979717219746213786L;
	public long uid;// 用户oapid
	public String msg_text;// 文本留言
	public String msg_voice; // 录音留言服务端URL
	public String msg_voice_local; // 本地存放地址
	public int type; // 留言类型   参见@FlowerMsgType
	public int state;// 状态  参见@FlowerMsgRecordState
	public int contentType;// 留言内容类型  参见@FlowerMsgContentType
	public int receiveFlowerNum;//收到花总数
	public int isSend;//24小时内已送花给fuid。=0为没送，=1为已经送过
	
	public class FlowerMsgRecordState{
		public static final int FINISH = 0; // 成功成功
		public static final int UPLOAD_ERR = 1; // 上传失败
	}
	
	public class FlowerMsgType{
		public static final int REQUEST_FLOWER = 1; // 索要鲜花留言
		public static final int THANKS_SEND = 2;  // 送花答谢留言
	}
	
	public class FlowerMsgContentType{
		public static final int MSG_CONTENT = 0; // 文本留言
		public static final int MSG_RECORD = 1;  // 录音留言
	}
	
	public void setContentType(int contentType) {
		this.contentType = contentType;
	}
	
	public void setState(int state) {
		this.state = state;
	}
	
	public String getMsgVoiceLocal() {
		// 之前有设置过就直接用
		if(!TextUtils.isEmpty(msg_voice_local)){
			return msg_voice_local;
		}
		// 否则尝试根据服务端URL拼出本地存放地址
		if(!TextUtils.isEmpty(msg_voice)){
			try {
				msg_voice_local = FileHelper.getDefaultAudioFile(msg_voice).getAbsolutePath();
				return msg_voice_local;
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return "";
	}
	
	public void setMsgVoiceLocal(String localRecordPath) {
		this.msg_voice_local = localRecordPath;
	}
	
	public void setUid(long uid) {
		this.uid = uid;
	}
	
	public void setMsgText(String content) {
		this.msg_text = content;
	}
	
	public void setMsgVoice(String recordUrl) {
		this.msg_voice = recordUrl;
	}
	
	public void setType(int type) {
		this.type = type;
	}
}
